/**
 * 2
 *  
 * @Author : roryrywang
 * @DateTime : 24-9-3 下午3:25
 */

#include <iostream>

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        string s;
        cin >> n >> s;
        int idx0 = -1;
        int idx1 = -1;
        for (int i = 0; i < n; ++i) {
            if (s[i] == '0') {
                idx0 = i + 1;
                cout << idx1 << " ";
            } else {
                idx1 = i + 1;
                cout << idx0 << " ";
            }
        }
        cout << endl;
    }
    return 0;
}